package slidingWindows;

public class lengthOfLongestSubstring {
    public int lengthOfLongestSubstring(String ss) {
        char[] s = ss.toCharArray();
        int left=0;
        int n=ss.length();
        int right=0;
        int[] hash=new int[128];
        int ret=0;
        for(right=0;right<n;right++){
            hash[s[right]]++;
            while(hash[s[right]]>1){
                hash[s[left]]--;
                left++;
            }
            ret=Math.max(right-left+1,ret);
        }
        return ret;
    }


}
